Skip to content

fix(#2809): make Algorithm getters const#2817

Merged
briansmith merged 1 commit intobriansmith:mainfrom
jalil-salame:jalil/const-getters
May 8, 2026
Merged

fix(#2809): make Algorithm getters const#2817
briansmith merged 1 commit intobriansmith:mainfrom
jalil-salame:jalil/const-getters

Conversation

@jalil-salame
Copy link
Copy Markdown
Contributor

This allows using the key_len in constants for type safety, e.g.

type CHACHA_KEY = [u8; ring::aead::CHACHA20_POLY1305.key_len()];

static DEFAULT_KEY: CHACHA_KEY = [0; ring::aead::CHACHA20_POLY1305.key_len()];

Closes #2809

Copy link
Copy Markdown
Owner

@briansmith briansmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Could you please update the commit message, e.g. "aead/quic: Make key/nonce/tag length accessors const."? We generally want the commit messages to be independent of any GitHub-isms.

This allows using the `key_len` in constants for type safety, e.g.

```rust
type CHACHA_KEY = [u8; ring::aead::CHACHA20_POLY1305.key_len()];

static DEFAULT_KEY: CHACHA_KEY = [0; ring::aead::CHACHA20_POLY1305.key_len()];
```

Signed-off-by: Jalil David Salamé Messina <jalil.salame@gmail.com>
@jalil-salame jalil-salame force-pushed the jalil/const-getters branch from 54eab20 to 87a34b8 Compare May 2, 2026 11:40
@jalil-salame jalil-salame requested a review from briansmith May 2, 2026 11:40
@jalil-salame
Copy link
Copy Markdown
Contributor Author

Thank you. Could you please update the commit message, e.g. "aead/quic: Make key/nonce/tag length accessors const."? We generally want the commit messages to be independent of any GitHub-isms.

Fixed, thanks for the review!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.51%. Comparing base (caa9e1d) to head (87a34b8).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/aead/algorithm.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2817      +/-   ##
==========================================
- Coverage   96.51%   96.51%   -0.01%     
==========================================
  Files         206      206              
  Lines       20517    20517              
  Branches      518      518              
==========================================
- Hits        19802    19801       -1     
  Misses        599      599              
- Partials      116      117       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jalil-salame
Copy link
Copy Markdown
Contributor Author

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.96%. Comparing base (caa9e1d) to head (87a34b8).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/aead/algorithm.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2817      +/-   ##
==========================================
- Coverage   96.51%   95.96%   -0.56%     
==========================================
  Files         206      206              
  Lines       20517    20517              
  Branches      518      518              
==========================================
- Hits        19802    19689     -113     
- Misses        599      703     +104     
- Partials      116      125       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This might be due to the branch being outdated since no lines where added/deleted.

@briansmith
Copy link
Copy Markdown
Owner

Don't worry about the coverage issue. It's an existing problem that tag_len() isn't covered.

@briansmith briansmith merged commit 99d1fad into briansmith:main May 8, 2026
159 of 161 checks passed
@jalil-salame jalil-salame deleted the jalil/const-getters branch May 8, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constify accessor methods to the Algorithm struct

2 participants